//
//  KBaseSearchFileDAO.m
//  KutulusLaw
//
//  Created by Mahmood1 on 12/11/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "KBaseSearchFileDAO.h"

@implementation KBaseSearchFileDAO

- (id)init {
    self = [super init];
    if (self) {
    }
    return self;
}
- (BOOL)searchFile:(KBaseSearchCommandDTO *)searchCommandDTO block:(void (^)(KBaseResponedSearchCommandDTO *, NSError *))block {
    return [self isValid:searchCommandDTO];
}

- (BOOL) isValid:(KBaseSearchCommandDTO *)searchCommandDTO {
	
	if (!searchCommandDTO) {
		return NO;
	}
	
	BOOL isValidAction = searchCommandDTO.action && [searchCommandDTO.action length] > 0;
	BOOL isValidSessionID = searchCommandDTO.sessionID && [searchCommandDTO.sessionID length] > 0;
	BOOL isValidModule = searchCommandDTO.module && [searchCommandDTO.module length] > 0;
	BOOL isValidAjaxAction = searchCommandDTO.ajaxAction && [searchCommandDTO.ajaxAction length] > 0;
	
	if (isValidAction && isValidSessionID && isValidModule && isValidAjaxAction) {
		return YES;
	}

	return NO;
}
@end
